<?php

namespace app\controller;

use support\Request;
use think\facade\Db;
use Webman\RedisQueue\Redis;
use EasyWeChat\Factory;
class Index
{
    public function index(Request $request)
    {

        $j=Db::connect('order')->table('order_assignment')->select([1,2]);
        $queue = 'app-message';
        // 数据，可以直接传数组，无需序列化
        $data = ['to' => 'tom@gmail.com', 'content' => 'hello'];
        // 投递消息
        //Redis::send($queue, $data);
       $s=self::class;
        $string = 'google 123, 456';
        $pattern = '/(\w+) (\d+), (\d+)/i';
        $replacement = 'runoob ${2}==$3';
        //$j= preg_replace($pattern, $replacement, $string);
        preg_match('/(\w+)$/i',$s,$a);

        return  json([$a,$s]);
    }

    public function view(Request $request)
    {
        return view('index/view', ['name' => 'webman']);
    }

    public function json(Request $request)
    {
        return json(['code' => 0, 'msg' => 'ok']);
    }

}
